﻿<html>
<head>
<link href="css/qam.css" rel="stylesheet" media="screen" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
</style>
</head>
<body>

	<div style="width:960px;margin:0 auto">
		<div id="message" ></div>
		
		<HR><h3>备份管理</h3>
		<div style="padding:10px;background:#E8E8FF;margin-top:10px;">
			<form method="post" action="#" name="myform" class="myform">
				<input type="button" value="备份" onclick="backup();" name="button"  />
			</form>
		</div>
		
		<div style="padding:10px;background:#E8E8FF;margin-top:10px;" id="listbox"></div>
		

	</div>



</body>

<script src="js/ajax.js" type="text/javascript"></script>
<script src="js/md5.js" type="text/javascript"></script>
<script src="js/function.js" type="text/javascript"></script>
<script>



function init(){showlist();}




function backup(){
	$$("message").innerHTML="正在备份";
	var _url=cgipath+"sql-backup";
	var ajax_obj=new AJAX_OBJ(_url,handle_backup,handle_error,5000);
	ajax_obj.postData(formToString(document.myform));
}
function handle_backup(xmlHttp){
	//$$("message").innerHTML=xmlHttp.responseText;return;
	eval("var ret_json="+xmlHttp.responseText);
	$$("message").innerHTML="【ret】"+ret_json.ret+"【msg】"+ret_json.msg;
	showlist();
}

function restore(t){
	$$("message").innerHTML="正在还原";
	var _url=cgipath+"sql-restore";
	var ajax_obj=new AJAX_OBJ(_url,handle_restore,handle_error,5000);
	ajax_obj.postData("&name="+t);
}
function handle_restore(xmlHttp){
	//$$("message").innerHTML=xmlHttp.responseText;return;
	eval("var ret_json="+xmlHttp.responseText);
	$$("message").innerHTML="【ret】"+ret_json.ret+"【msg】"+ret_json.msg;
	showlist();
}

function del(t){
	$$("message").innerHTML="正在删除";
	var _url=cgipath+"sql-del";
	var ajax_obj=new AJAX_OBJ(_url,handle_del,handle_error,5000);
	ajax_obj.postData("&name="+t);
}
function handle_del(xmlHttp){
	//$$("message").innerHTML=xmlHttp.responseText;return;
	eval("var ret_json="+xmlHttp.responseText);
	$$("message").innerHTML="【ret】"+ret_json.ret+"【msg】"+ret_json.msg;
	showlist();
}



function showlist(){
	var _url=cgipath+"sql-showlist";
	var ajax_obj=new AJAX_OBJ(_url,handle_showlist,handle_error,5000);
	ajax_obj.postData();
}

function handle_showlist(xmlHttp){
	//$$("message").innerHTML=xmlHttp.responseText;return;
	eval("var ret_json="+xmlHttp.responseText);
	var str="<table><thead><tr>";
	str+="<td><a href='javascript:order=\"id\";desc=bin_exchange(desc);list_page(0)'>序号</a></td>";
	str+="<td><a href='javascript:order=\"name\";desc=bin_exchange(desc);list_page(0)'>名称</a></td>";
	str+="<td>操作</td></tr></thead>";
	for(var i=0;i<ret_json.listdata.length;i++){
		str+="<tr><td>"+(i+1)+"</td>";
		str+="<td>"+ret_json.listdata[i].name+"</td>";
		str+="<td><a href='#' onclick=\"restore('"+ret_json.listdata[i].name+"')\">还原</a><a href='#' onclick=\"del('"+ret_json.listdata[i].name+"')\">删除</a></td></tr>";
	}
	str+="</table>";
	$$("listbox").innerHTML=str
}



</script>
<script src="js/public.js" type="text/javascript"></script>


</html>